package com.hong.decorator;

import com.hong.aop.Greeting;

/**
 * 装饰器模式抽象类
 */
public class AbstractGreetingDecorator implements Greeting{

    // 这里与静态代理模式不同,持有的是Greeting,而不是具体的实现
    private Greeting greeting;

    public AbstractGreetingDecorator(Greeting greeting) {
        this.greeting = greeting;
    }

    @Override
    public void sayHello(String name) {
        greeting.sayHello(name);
    }
}
